import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import store from './store'

//路由跳转前
router.beforeEach((to, from, next) => {
  let isLogin = sessionStorage.getItem('islogin');

  // if (to.path == '/logout') {
  //   sessionStorage.clear();
  //   next({ path: '/login' });
  // } else if (to.path == '/login') {
  //   if (isLogin != null) {
  //     next({ path: '/main/123' });
  //   }
  // } else if (isLogin == null) {
  //   next({ path: '/login' });
  // }

  next();
});

Vue.use(ElementUI);
Vue.prototype.axios = axios;

new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store,
  render: h => h(App)
})
